#!/bin/bash

if [ "$#" -ne 1 ];then
    echo "error something miss"
    exit 1
fi

target_path=$1

if [ ! -d "$target_path" ];then
    echo "Error: Directory '$target_path' does not exist."
    exit 1
fi

find "$target_path" -type d > /tmp/dir.txt
find "$target_path" -type f > /tmp/files.txt

echo "Directory names have been written to /tmp/dir.txt"
echo "File names have been written to /tmp/files.txt"

